
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>strategy · 驱动管理</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Gj">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../config.html" />
    
    
    <link rel="prev" href="logs.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    概要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../Framework.html">
            
                <a href="../../Framework.html">
            
                    
                    架构
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">src目录</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../api.html">
            
                <a href="../api.html">
            
                    
                    api
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../common.html">
            
                <a href="../common.html">
            
                    
                    common
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../components.html">
            
                <a href="../components.html">
            
                    
                    components
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../filters.html">
            
                <a href="../filters.html">
            
                    
                    filters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../layout.html">
            
                <a href="../layout.html">
            
                    
                    layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../mixins.html">
            
                <a href="../mixins.html">
            
                    
                    mixins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../model.html">
            
                <a href="../model.html">
            
                    
                    model
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="../router.html">
            
                <a href="../router.html">
            
                    
                    router
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="../store.html">
            
                <a href="../store.html">
            
                    
                    store
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="../styles.html">
            
                <a href="../styles.html">
            
                    
                    styles
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="../types.html">
            
                <a href="../types.html">
            
                    
                    types
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="../utils.html">
            
                <a href="../utils.html">
            
                    
                    utils
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="./">
            
                <a href="./">
            
                    
                    views
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.13.1" data-path="init.html">
            
                <a href="init.html">
            
                    
                    init
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.2" data-path="login.html">
            
                <a href="login.html">
            
                    
                    login
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.3" data-path="drive.html">
            
                <a href="drive.html">
            
                    
                    drive
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13.4" data-path="logs.html">
            
                <a href="logs.html">
            
                    
                    logs
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.13.5" data-path="strategy.html">
            
                <a href="strategy.html">
            
                    
                    strategy
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="../config.html">
            
                <a href="../config.html">
            
                    
                    配置文件
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >strategy</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h3 id="&#x767B;&#x5F55;&#x9875;&#x9762;">&#x767B;&#x5F55;&#x9875;&#x9762;</h3>
<blockquote>
<p>&#x5347;&#x7EA7;&#x7B56;&#x7565; </p>
</blockquote>
<p><img src="../../images/strategy.jpg" alt=""></p>
<pre class="language-"><code class="lang-typescript"><span class="token operator">&lt;</span>script lang<span class="token operator">=</span><span class="token string">&quot;ts&quot;</span><span class="token operator">&gt;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Component<span class="token punctuation">,</span> Vue <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-property-decorator&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> ModalTemp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;./components&quot;</span><span class="token punctuation">;</span><span class="token comment">// &#x8BBE;&#x7F6E;&#x7684;&#x6A21;&#x6001;&#x7EC4;&#x4EF6;&#x5F15;&#x5165;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> strategy <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/api/strategy&quot;</span><span class="token punctuation">;</span><span class="token comment">// &#x63A5;&#x53E3;&#x5F15;&#x5165;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> IStrategy <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/model/Strategy&quot;</span><span class="token punctuation">;</span><span class="token comment">// Strategy Model DTO</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> TimesToDayHourMin <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils&quot;</span><span class="token punctuation">;</span><span class="token comment">// &#x65F6;&#x95F4;&#x6233;&#x8F6C;&#x6362;&#x5DE5;&#x5177;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Method2Val <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/common/Enum2Val&quot;</span><span class="token punctuation">;</span> <span class="token comment">// &#x679A;&#x4E3E;&#x5BF9;&#x5E94;value</span>

@<span class="token function">Component</span><span class="token punctuation">(</span><span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">&quot;Strategy&quot;</span><span class="token punctuation">,</span> components<span class="token operator">:</span> <span class="token punctuation">{</span> ModalTemp <span class="token punctuation">}</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">class</span> <span class="token class-name">Strategy</span> <span class="token keyword">extends</span> <span class="token class-name">Vue</span> <span class="token punctuation">{</span>
  <span class="token keyword">private</span> Method2Val<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> Method2Val<span class="token punctuation">;</span><span class="token comment">// &#x9700;&#x8981;&#x5148;&#x58F0;&#x660E;&#x624D;&#x53EF;&#x4EE5;&#x518D;Dom&#x4E0A;&#x4F7F;&#x7528;</span>
  <span class="token keyword">private</span> data<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
    time<span class="token operator">:</span> <span class="token punctuation">{</span>
      day<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
      hour<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
      min<span class="token operator">:</span> <span class="token number">10</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    method<span class="token operator">:</span> <span class="token number">0</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token keyword">async</span> <span class="token function">openModal</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x6253;&#x5F00;&#x8BBE;&#x7F6E;&#x6A21;&#x6001; &#x51FD;&#x6570;</span>
    <span class="token keyword">const</span> temp<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$refs<span class="token punctuation">.</span>modal<span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">$nextTick</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      temp<span class="token punctuation">.</span><span class="token function">showModal</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>data<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token keyword">async</span> <span class="token function">initData</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x83B7;&#x53D6;&#x6570;&#x636E;&#x63A5;&#x53E3;</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span> data <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">await</span> <span class="token function">strategy</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>data<span class="token punctuation">.</span>errNo <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> strategy <span class="token punctuation">}</span> <span class="token operator">=</span> data<span class="token punctuation">.</span>item<span class="token punctuation">;</span>
      <span class="token keyword">const</span> <span class="token punctuation">{</span> method<span class="token punctuation">,</span> timeInterval <span class="token punctuation">}</span><span class="token operator">:</span> IStrategy <span class="token operator">=</span> strategy<span class="token punctuation">;</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>timeInterval<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">const</span> <span class="token punctuation">[</span>day<span class="token punctuation">,</span> hour<span class="token punctuation">,</span> min<span class="token punctuation">]</span><span class="token operator">:</span> <span class="token builtin">number</span><span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token function">TimesToDayHourMin</span><span class="token punctuation">(</span>timeInterval<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span>data<span class="token punctuation">.</span>time <span class="token operator">=</span> <span class="token punctuation">{</span> day<span class="token punctuation">,</span> hour<span class="token punctuation">,</span> min <span class="token punctuation">}</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>data<span class="token punctuation">.</span>method <span class="token operator">=</span> method <span class="token operator">||</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token function">created</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x94A9;&#x5B50;&#xFF0C;&#x9875;&#x9762;&#x52A0;&#x8F7D;&#x524D;&#x89E6;&#x53D1;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">initData</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>
<blockquote>
<p>&#x8BBE;&#x7F6E;Modal</p>
</blockquote>
<p><img src="../../images/strategy_modal.jpg" alt=""></p>
<pre class="language-"><code class="lang-typescript"><span class="token operator">&lt;</span>script lang<span class="token operator">=</span><span class="token string">&quot;ts&quot;</span><span class="token operator">&gt;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Component<span class="token punctuation">,</span> Emit<span class="token punctuation">,</span> Vue <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;vue-property-decorator&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> selectColumns <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/common/AntSelectConfig&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> strategy_set <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/api/strategy&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> CloneDeep<span class="token punctuation">,</span> DayHourMinToTimes <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/utils&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> IStrategy <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&quot;@/model/Strategy&quot;</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> formItemLayout <span class="token keyword">from</span> <span class="token string">&quot;@/common/FormItemLayout&quot;</span><span class="token punctuation">;</span>

@<span class="token function">Component</span><span class="token punctuation">(</span><span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">&quot;StrategyModal&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">class</span> <span class="token class-name">StrategyModal</span> <span class="token keyword">extends</span> <span class="token class-name">Vue</span> <span class="token punctuation">{</span>
  <span class="token keyword">private</span> selectColumns<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> selectColumns<span class="token punctuation">;</span><span class="token comment">// &#x9A71;&#x52A8;&#x5347;&#x7EA7;&#x65B9;&#x5F0F; &#x4E0B;&#x62C9;&#x7684;&#x9759;&#x6001;&#x6570;&#x636E;</span>
  <span class="token keyword">private</span> visible<span class="token operator">:</span> <span class="token builtin">boolean</span> <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span> <span class="token comment">// Modal &#x663E;&#x793A;/&#x9690;&#x85CF;</span>
  <span class="token keyword">private</span> form<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">;</span> <span class="token comment">// &#x8868;&#x5355;&#x6570;&#x636E;</span>
  <span class="token keyword">private</span> formItemLayout<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> formItemLayout<span class="token punctuation">;</span> <span class="token comment">// form &#x7684;&#x6837;&#x5F0F;</span>
  <span class="token keyword">private</span> minMin<span class="token operator">:</span> <span class="token builtin">number</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> <span class="token comment">// &#x6700;&#x5C0F; &#x5206;&#x949F;</span>

  <span class="token keyword">private</span> upgradeTimes<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
    day<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
    hour<span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
    min<span class="token operator">:</span> <span class="token number">10</span>
  <span class="token punctuation">}</span><span class="token punctuation">;</span>

  <span class="token function">created</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x94A9;&#x5B50; &#x9875;&#x9762;&#x52A0;&#x8F7D;&#x524D;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>form <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>$form<span class="token punctuation">.</span><span class="token function">createForm</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">// &#x521D;&#x59CB;&#x5316; form&#x8868;&#x5355;</span>
  <span class="token punctuation">}</span>

  <span class="token function">handlerTime</span><span class="token punctuation">(</span><span class="token parameter">key<span class="token operator">:</span> <span class="token builtin">string</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x5F53; &#x65E5;/&#x65F6;/&#x5206; &#x53D1;&#x751F;&#x6539;&#x53D8;&#x65F6; &#x89E6;&#x53D1;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>upgradeTimes <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">fmtDayHourMin</span><span class="token punctuation">(</span><span class="token keyword">this</span><span class="token punctuation">.</span>upgradeTimes<span class="token punctuation">,</span> key<span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token function">fmtDayHourMin</span><span class="token punctuation">(</span><span class="token parameter">upgrades<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> key<span class="token operator">:</span> <span class="token builtin">string</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x683C;&#x5F0F;&#x5316; &#x65E5;/&#x65F6;/&#x5206; &#x6700;&#x5927; 7 0 0 &#x6700;&#x5C0F; 0 0 10</span>
    <span class="token keyword">const</span> maxDay <span class="token operator">=</span> <span class="token number">7</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> cache <span class="token operator">=</span> <span class="token function">CloneDeep</span><span class="token punctuation">(</span>upgrades<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span> day<span class="token punctuation">,</span> hour<span class="token punctuation">,</span> min <span class="token punctuation">}</span> <span class="token operator">=</span> upgrades<span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>day<span class="token punctuation">)</span> cache<span class="token punctuation">.</span>day <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>hour<span class="token punctuation">)</span> cache<span class="token punctuation">.</span>hour <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>min<span class="token punctuation">)</span> cache<span class="token punctuation">.</span>min <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span>day <span class="token operator">===</span> maxDay <span class="token operator">&amp;&amp;</span> <span class="token punctuation">(</span>hour <span class="token operator">!=</span> <span class="token number">0</span> <span class="token operator">||</span> min <span class="token operator">!=</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">&quot;hour&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;min&quot;</span><span class="token punctuation">]</span><span class="token punctuation">.</span><span class="token function">includes</span><span class="token punctuation">(</span>key<span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
          cache<span class="token punctuation">.</span>day <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
          cache<span class="token punctuation">.</span>hour <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
          cache<span class="token punctuation">.</span>min <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
      <span class="token punctuation">}</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>minMin <span class="token operator">=</span> day <span class="token operator">===</span> <span class="token number">0</span> <span class="token operator">&amp;&amp;</span> hour <span class="token operator">===</span> <span class="token number">0</span> <span class="token operator">?</span> <span class="token number">10</span> <span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span> cache<span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> cache<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token function">handleCancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x5173;&#x95ED; Modal</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>visible <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token function">handleSubmit</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x8868;&#x5355;&#x63D0;&#x4EA4;&#x524D;&#x6821;&#x9A8C;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">validateFields</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token parameter">err<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">,</span> values<span class="token operator">:</span> <span class="token builtin">any</span></span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>err<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">const</span> <span class="token punctuation">{</span> day<span class="token punctuation">,</span> hour<span class="token punctuation">,</span> min <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token keyword">this</span><span class="token punctuation">.</span>upgradeTimes<span class="token punctuation">;</span>
        <span class="token keyword">const</span> timeInterval <span class="token operator">=</span> <span class="token function">DayHourMinToTimes</span><span class="token punctuation">(</span>day<span class="token punctuation">,</span> hour<span class="token punctuation">,</span> min<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">const</span> result<span class="token operator">:</span> <span class="token builtin">any</span> <span class="token operator">=</span> <span class="token punctuation">{</span> <span class="token operator">...</span>values<span class="token punctuation">,</span> timeInterval <span class="token punctuation">}</span><span class="token punctuation">;</span>
        <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">submit</span><span class="token punctuation">(</span>result<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  @<span class="token function">Emit</span><span class="token punctuation">(</span><span class="token string">&quot;submit&quot;</span><span class="token punctuation">)</span>
  <span class="token keyword">async</span> <span class="token function">submit</span><span class="token punctuation">(</span><span class="token parameter">form<span class="token operator">:</span> IStrategy</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token comment">// &#x8868;&#x5355;&#x63D0;&#x4EA4;</span>
    <span class="token keyword">try</span> <span class="token punctuation">{</span>
      <span class="token keyword">await</span> <span class="token function">strategy_set</span><span class="token punctuation">(</span>form<span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span><span class="token function">handleCancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>$message<span class="token punctuation">.</span><span class="token function">success</span><span class="token punctuation">(</span><span class="token string">&quot;&#x64CD;&#x4F5C;&#x6210;&#x529F;&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
      <span class="token keyword">return</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span> <span class="token keyword">catch</span> <span class="token punctuation">(</span>error<span class="token punctuation">)</span> <span class="token punctuation">{</span>
      <span class="token keyword">return</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token function">showModal</span><span class="token punctuation">(</span>values<span class="token operator">:</span> <span class="token builtin">any</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span> <span class="token punctuation">{</span><span class="token comment">// Modal&#x663E;&#x793A;&#xFF0C;&#x5E76;&#x8BBE;&#x7F6E; &#x8868;&#x5355;&#x9ED8;&#x8BA4;&#x503C;</span>
    <span class="token keyword">const</span> <span class="token punctuation">{</span> method<span class="token punctuation">,</span> time <span class="token punctuation">}</span> <span class="token operator">=</span> <span class="token function">CloneDeep</span><span class="token punctuation">(</span>values<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>upgradeTimes <span class="token operator">=</span> time<span class="token punctuation">;</span>
    <span class="token function">setTimeout</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token keyword">this</span><span class="token punctuation">.</span>form<span class="token punctuation">.</span><span class="token function">setFieldsValue</span><span class="token punctuation">(</span><span class="token punctuation">{</span> method <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">this</span><span class="token punctuation">.</span>visible <span class="token operator">=</span> <span class="token boolean">true</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>script<span class="token operator">&gt;</span>
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="logs.html" class="navigation navigation-prev " aria-label="Previous page: logs">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../config.html" class="navigation navigation-next " aria-label="Next page: 配置文件">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"strategy","level":"2.13.5","depth":2,"next":{"title":"配置文件","level":"2.14","depth":1,"path":"src/config.md","ref":"src/config.md","articles":[]},"previous":{"title":"logs","level":"2.13.4","depth":2,"path":"src/views/logs.md","ref":"src/views/logs.md","articles":[]},"dir":"ltr"},"config":{"plugins":["chapter-fold","-lunr","-search","search-pro","-highlight","prism"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"]},"chapter-fold":{},"search-pro":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Gj","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"驱动管理","language":"zh-hans","gitbook":"3.2.3","description":"驱动管理Web端"},"file":{"path":"src/views/strategy.md","mtime":"2020-02-28T06:34:50.649Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-03T02:33:20.679Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

